<?php
$con = mysql_connect("localhost", "test", "123");
if (!$con) {
    die('Could not connect: ' . mysql_error());
}

echo "conn success";

mysql_select_db("test", $con);

// $sql = "CREATE TABLE Persons 
// (
// FirstName varchar(15),
// LastName varchar(15),
// Age int
// )";
// mysql_query($sql,$con);

// mysql_query("INSERT INTO Persons (FirstName, LastName, Age) 
// VALUES ('Peter', 'Griffin', '35')");

// mysql_query("INSERT INTO Persons (FirstName, LastName, Age) 
// VALUES ('Glenn', 'Quagmire', '33')");


$result = mysql_query("SELECT * FROM Persons");

echo mysql_num_rows($result);
while ($row = mysql_fetch_array($result)) {
    echo $row['FirstName'] . " " . $row['LastName'];
    echo "<br />";
}

// $result = mysql_query("SELECT * FROM Persons
// WHERE FirstName='Peter'");

// echo mysql_num_rows($result);

// while($row = mysql_fetch_array($result))
//   {
//   echo $row['FirstName'] . " " . $row['LastName'];
//   echo "<br />";
//   }

mysql_close($con);
?>